package com.colin.app.activity.view.button;

import android.view.View;

import com.colin.app.R;
import com.colin.app.activity.view.ViewContract;
import com.colin.app.activity.view.ViewPresenterImpl;
import com.colin.app.app.AppActivity;
import com.colin.app.bean.DemoBean;
import com.colin.library.view.FormatEditText;


public class ButtonActivity extends AppActivity implements ViewContract.ViewView, View.OnClickListener {
    private ViewContract.ViewPresenter mViewPresenter = null;
    private FormatEditText edit_input_phone ;
    private FormatEditText edit_input_card ;
    private FormatEditText edit_input_id_card ;
    @Override
    protected void onDestroy() {
        if (null!=mViewPresenter){
            mViewPresenter.destroy();
            mViewPresenter = null;
        }
        super.onDestroy();
    }

    @Override
    public void initPresenter() {
        DemoBean demoBean = getIntent().getExtras().getParcelable("clazz");
        mViewPresenter = new ViewPresenterImpl(this, this, demoBean);
    }

    @Override
    public int initViewLayoutID() {
        return R.layout.activity_button;
    }

    @Override
    public void initView() {
        this.edit_input_phone = (FormatEditText) this.findViewById(R.id.edit_input_phone);
        this.edit_input_card = (FormatEditText) this.findViewById(R.id.edit_input_card);
        this.edit_input_id_card = (FormatEditText) this.findViewById(R.id.edit_input_id_card);
    }

    @Override
    public void initData() {
        mViewPresenter.setData();
    }

    @Override
    public void initListener() {
        this.findViewById(R.id.button_default).setOnClickListener(this);
        this.findViewById(R.id.button_style).setOnClickListener(this);
        this.findViewById(R.id.button_image).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.button_default:
                alertShow(getString(R.string.button_default));
                break;
            case R.id.button_style:
                alertShow(getString(R.string.button_style));
                break;
            case R.id.button_image:
                alertShow(getString(R.string.button_image));
                break;
        }
    }
}
